-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Linux cgrpoup v2, issue-4885 #5068
Conversation
@nezdali , I deployed your change into my own cluster that has cgroupsv2 and printed SystemResources object.
The printed values are following.
While the requests for CPU corresponds to YAML specification, the memory seems to be not accurate. |
After more research it turns out that GuaranteedMemoryInBytes is the Resource Memory Limit (in k8s terms) which is read from /sys/fs/cgroup/memory.max |
...raries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationProvider.cs
Outdated
Show resolved
Hide resolved
…ing/Linux/LinuxUtilizationProvider.cs Co-authored-by: Igor Velikorossov <RussKie@users.noreply.github.com>
…uhostcount in some cases
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/SystemResources.cs
Outdated
Show resolved
Hide resolved
...raries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/LinuxUtilizationProvider.cs
Outdated
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/IFileSystem.cs
Outdated
Show resolved
Hide resolved
...braries/Microsoft.Extensions.Diagnostics.ResourceMonitoring/Linux/ILinuxUtilizationParser.cs
Show resolved
Hide resolved
@@ -14,8 +14,10 @@ namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux; | |||
/// This class is not thread safe. | |||
/// When the same instance is called by multiple threads it may return corrupted data. | |||
/// </remarks> | |||
internal sealed class LinuxUtilizationParser | |||
internal sealed class LinuxUtilizationParser : ILinuxUtilizationParser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this class be renamed to LinuxUtilizationParserCgroupV1
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually both parsers do not parse only cgroup fs at /sys/fs/cgroup , but also /proc , but the main purpose is to parse the cgroup so we rename if that makes code more readable
…ing/Linux/IFileSystem.cs Co-authored-by: Nikita Balabaev <xakep139@users.noreply.github.com>
/// Get directory names on the filesystem based on the provided pattern. | ||
/// </summary> | ||
/// <returns>string.</returns> | ||
string[] GetDirectoryNames(string directory, string pattern); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though this is an internal class I'd caution against using mutable arrays as return values. This could lead to some gnarly hard to track bugs.
Could this be changed to something like IList<string>
or IEnumerable<string>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, will do the changes in another PR since this one is merged already.
Fixes #4885
Microsoft Reviewers: Open in CodeFlow